<extend name="Public/base" />
<block name="content">
<div class="row-fluid">
    <div class="block">
        <div class="navbar navbar-inner block-header">
            <div class="muted pull-left">用户组授权</div>
        </div>
        <div class="block-content collapse in">
            <div class="span12">
                <form class="form-horizontal" action="{:U('addToGroup')}" method="post" enctype="application/x-www-form-urlencoded" >
                    <label class="item-label">{$nickname} 所属的用户组列表</label>
                    <volist name="auth_groups" id="vo">
                        <label class="checkbox">
                            <input class="auth_groups" type="checkbox" name="group_id[]" value="{$vo.id}">{$vo.title}
                        </label>
                    </volist>
                    <input type="hidden" name="uid" value="{:I('id')}">
                    <input type="hidden" name="batch" value="true">
                    <div style="margin-top: 10px;">
                        <button type="submit" class="btn submit-btn ajax-post" target-form="form-horizontal">确 定</button>
                        <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
</block>
<block name="script">
<script type="text/javascript">
    $(function(){
        var group = [{$user_groups}];
        $('.auth_groups').each(function(){
            if( $.inArray( parseInt(this.value,10),group )>-1 ){
                $(this).prop('checked',true);
            }
        });
    });
    // 导航高亮
    highlight_subnav('{:U('User/index')}');
</script>
</block>